import service from "@/utils/request";

/**
 * 数据连接获取左侧分组树
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getExistDataConnect = (data) => {
    return service.post('dataConnectController/getExistDataConnect', data);
}


/**
 * 获取数据源的连接信息
 * @param {*} dsNO 数据源连接id
 * @returns
 */
export const getDataConnectInfo = (data) => {
    // return service.get('dataConnectController/getDataConnectInfo', {params} )

    return service.post('dataConnectController/getDataConnectInfo', data)
}


/**
 * 测试链接
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const testDataConnect = (data) => {
    return service.post('dataConnectController/testDataConnect', data);
}

/**
 * 获取表名或注释或者视图的名称或注释
 */
export const getDSTableViewInfo = (data) => {
    return service.post('dataConnectController/getDSTableViewInfo', data);
}
/**
 * 新建根文件夹，二级文件夹，文件夹重命名，节点重命名
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export  const saveDSNodeName=(data) =>{
    return service.post('dataConnectController/saveDSNodeName',data)
}
/**
 * 新建根节点或在分组下新建连接
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const saveDSConnectConfig = (data)=>{
    return service.post('dataConnectController/saveDSConnectConfig',data)
}
/**
 * 删除文件夹或节点
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const deleteDsConnect = (data) =>{
    return service.post('dataConnectController/deleteDSConnect',data)
}
/**
 * 上移下移
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export  const moveDSNodeOrder = (data) =>{
    return service.post('dataConnectController/moveDSNodeOrder',data)
}